home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / test / lib / why.c < prev   
C/C++ Source or Header  |  1992-11-23  |  647b  |  35 lines

  1.  
  2. #include <exec/types.h>
  3. #include <libraries/dos.h>
  4. #include <libraries/dosextens.h>
  5. #include <stdio.h>
  6.  
  7. typedef struct CommandLineInterface CLI;
  8.  
  9. main(ac, av)
  10. char *av[];
  11. {
  12.     struct Process *proc = FindTask(NULL);
  13.  
  14.     if (ac > 1) {
  15.     FILE *fi = fopen("ram:z", "w");
  16.     long fh;
  17.     long fh2;
  18.     fprintf(fi, "ram:why\n");
  19.     fclose(fi);
  20.     if (fh = Open("ram:z", 1005)) {
  21.         fclose(stderr);
  22.         fh2 = Open("*", 1006);
  23.         puts("ok");
  24.         printf("execute: %d\n", Execute(av[1], fh, fh2));
  25.         Close(fh);
  26.         Close(fh2);
  27.     }
  28.     }
  29.  
  30.     CLI *cli = (CLI *)((long)proc->pr_CLI << 2);
  31.     if (cli)
  32.     printf("cli return code: %d\n", cli->cli_ReturnCode);
  33. }
  34.  
  35.